﻿using OT.HikiSecureCenterApis.Req;
using OT.HikiSecureCenterApis.Res;
using OT.HikiSecureCenterApis.Service.Resources.Res;

namespace OT.HikiSecureCenterApis.Service.Resources
{
    /// <summary>
    /// 资源目录 --> 设备网管接口
    /// </summary>
    public partial class ResourcesService
    {
        /// <summary>
        /// 获取资源的历史在线记录接口 /api/nms/v1/online/history_status
        /// 获取资源的历史在线记录接口
        /// </summary>
        /// <remarks>综合安防管理平台iSecure Center V1.3及以上版本</remarks>
        /// <param name="indexCode">必填 资源编码，从获取资源列表v2接口获取返回报文中的indexCode字段</param>
        /// <param name="resourceType">必填 资源类型, 参考附录A.64 网管资源类型
        /// https://open.hikvision.com/docs/0f6e8e1e41a14304aeecd287530b9c95?curNodeId=0f6e8e1e41a14304aeecd287530b9c95#eb9b240e
        /// 编码设备 encodeDevice 
        /// 监控点 camera
        /// 存储设备 storageDevice
        /// 解码设备 decodeDevice
        /// 门禁设备 acsDevice
        /// 门禁点 door
        /// 读卡器 reader
        /// 梯控主机 ladderController
        /// 梯控读卡器 ladderCardReader
        /// 可视对讲设备 visDevice
        /// </param>
        /// <param name="page">非必填 </param>
        /// <returns><see cref="ResRoot"/></returns>
        public async Task<ResParameter<ResPageData<ResOnlineHistor>>?> OnlineHistorAsync(string indexCode, string resourceType, ReqPageDate page = null) =>
          await SecureCenterApis.PostAsync<ResPageData<ResOnlineHistor>>("/api/nms/v1/online/history_status", 1.3, new
          {
              indexCode = indexCode,
              resourceType = resourceType,
              startDate = page?.startTime,
              endDate = page?.endTime,
              pageNo = page?.pageNo ?? 1,
              pageSize = page?.pageSize ?? 500
          });
    }
}
